package com.clouddot.baipai.presenter;


import com.clouddot.baipai.contract.IAlaunchActivityContract;
import com.clouddot.baipai.http.entity.response.getBanPaiModelResponse;

import org.wxy.sdk.base.impl.BasePresenterImpl;

import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.schedulers.Schedulers;

public class AlaunchActivityPresenter extends BasePresenterImpl<IAlaunchActivityContract.IView, IAlaunchActivityContract.IModel> implements IAlaunchActivityContract.IPresenter {
    public AlaunchActivityPresenter(IAlaunchActivityContract.IView view, IAlaunchActivityContract.IModel model) {
        super(view, model);
    }


    @Override
    public void getBanPaiModel(final int flag) {
        Subscription subscription = mModel.getBanPaiModel("GetSysParamValue", "ClassCardParam")
                .subscribeOn(Schedulers.newThread())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Action1<getBanPaiModelResponse>() {
                               @Override
                               public void call(getBanPaiModelResponse response) {
                                   mView.success(flag, response);
                               }
                           }
                        , new Action1<Throwable>() {
                            @Override
                            public void call(Throwable throwable) {
                                mView.fail(flag, throwable.getMessage());

                            }
                        });
        addSubscription(subscription);
    }


}
